Skip to content

Add section on dropping DelayedInit - #2583

Merged
odersky merged 5 commits into
scala:masterfrom
dotty-staging:add-reference-2
May 29, 2017
Merged

odersky merged 5 commits into
scala:masterfrom
dotty-staging:add-reference-2

Conversation

@odersky

@odersky odersky commented May 29, 2017

Copy link
Copy Markdown
Contributor

No description provided.

for benchmarking! Also, if you want to access the command line arguments,
you need to use an explicit `main` method for that.

object Hello extends App {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, is there any point in doing extends App?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, good catch.

@smarter

smarter commented May 29, 2017

Copy link
Copy Markdown
Member

See also #559 which lead to the creation dotty.runtime.LegacyApp.

@smarter

smarter commented May 29, 2017

Copy link
Copy Markdown
Member

/cc @olafurpg in case you weren't aware of it: #559

@odersky

odersky commented May 29, 2017

Copy link
Copy Markdown
Contributor Author

#559 does not seem to be an issue anymore, at least not for simple cases where we do not access args. I added a test.

@odersky
odersky force-pushed the add-reference-2 branch from 97ebc45 to 28f2f23 Compare May 29, 2017 18:10
@odersky
odersky merged commit ec92d30 into scala:master May 29, 2017
@smarter smarter mentioned this pull request May 29, 2017
@olafurpg

Copy link
Copy Markdown
Contributor

Thanks @smarter I opened scalacenter/scalafix#174 to handle the cases when args is accessed. Currently, that case compiles but args == null at runtime. What do you think about removing args to get a compile-time error instead?

https://github.com/lampepfl/scala/blob/7ecfce1fb8d39275f082aaa3ad4dc0eee197391c/src/library/scala/App.scala#L46

@smarter

smarter commented May 30, 2017

Copy link
Copy Markdown
Member

We can't really remove it because it comes from scala-library, and we don't recompile scala-library currently in dotty, we use the one from 2.11.11 as-is.

@olafurpg

Copy link
Copy Markdown
Contributor

I see, that makes sense @smarter

Dotty allows this only if `T` is a class type. The change was made because
unrestricted type projection is [unsound](https://github.com/lampepfl/dotty/issues/1050).

The restriction rule out the [type-level encoding of compbinator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/s/compbinator/combinator

@olafurpg

olafurpg commented Jun 8, 2017

Copy link
Copy Markdown
Contributor

We just added the Scalafix NoExtendsApp rewrite that replaces extends App with an explicit main function, regardless if args is used or not https://scalacenter.github.io/scalafix/#NoExtendsApp

@allanrenucci
allanrenucci deleted the add-reference-2 branch December 14, 2017 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants